
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>drive · 驱动管理</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Gj">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="logs.html" />
    
    
    <link rel="prev" href="login.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    概要
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../Framework.html">
            
                <a href="../../Framework.html">
            
                    
                    架构
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">src目录</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../api.html">
            
                <a href="../api.html">
            
                    
                    api
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../common.html">
            
                <a href="../common.html">
            
                    
                    common
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../components.html">
            
                <a href="../components.html">
            
                    
                    components
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="../filters.html">
            
                <a href="../filters.html">
            
                    
                    filters
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="../layout.html">
            
                <a href="../layout.html">
            
                    
                    layout
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="../mixins.html">
            
                <a href="../mixins.html">
            
                    
                    mixins
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="../model.html">
            
                <a href="../model.html">
            
                    
                    model
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="../router.html">
            
                <a href="../router.html">
            
                    
                    router
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="../store.html">
            
                <a href="../store.html">
            
                    
                    store
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="../styles.html">
            
                <a href="../styles.html">
            
                    
                    styles
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="../types.html">
            
                <a href="../types.html">
            
                    
                    types
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="../utils.html">
            
                <a href="../utils.html">
            
                    
                    utils
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="./">
            
                <a href="./">
            
                    
                    views
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.13.1" data-path="init.html">
            
                <a href="init.html">
            
                    
                    init
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.2" data-path="login.html">
            
                <a href="login.html">
            
                    
                    login
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.13.3" data-path="drive.html">
            
                <a href="drive.html">
            
                    
                    drive
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.4" data-path="logs.html">
            
                <a href="logs.html">
            
                    
                    logs
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.5" data-path="strategy.html">
            
                <a href="strategy.html">
            
                    
                    strategy
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="../config.html">
            
                <a href="../config.html">
            
                    
                    配置文件
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >drive</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x9A71;&#x52A8;&#x7BA1;&#x7406;">&#x9A71;&#x52A8;&#x7BA1;&#x7406;</h3>
<blockquote>
<p>&#x9A71;&#x52A8;&#x7BA1;&#x7406;&#x5206;&#x6210;&#x4E24;&#x4E2A;&#x5B50;&#x6A21;&#x5757;&#xFF1A; &#x5F53;&#x524D;&#x9A71;&#x52A8;&#x3001;&#x9A71;&#x52A8;&#x4E00;&#x89C8;</p>
</blockquote>
<h5 id="componentscurrent">components/Current</h5>
<blockquote>
<p>&#x5F53;&#x524D;&#x9A71;&#x52A8;</p>
</blockquote>
<p><img src="../../images/current_drive.jpg" alt=""></p>
<pre class="language-"><code class="lang-typescript"><span class="token operator">&lt;</span>script lang<span class="token operator">=</span><span class="token string">&quot;ts&quot;</span><span class="token operator">&gt;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Component<span class="token punctuation">,</span> Vue <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;vue-property-decorator&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x88C5;&#x9970;&#x5668;&#x5F15;&#x5165;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> OsType<span class="token punctuation">,</span> DriverType <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/utils/VEnum&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x679A;&#x4E3E;</span>
<span class="token keyword">import</span> PanelTemp <span class="token keyword">from</span> <span class="token string">&quot;./Panel.vue&quot;</span><span class="token punctuation">;</span><span class="token comment">// &#x81EA;&#x5B9A;&#x4E49;&#x9762;&#x677F;&#x7EC4;&#x4EF6;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> drive_pages <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/api/drive&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x63A5;&#x53E3;</span>
@<span class="token function">Component</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
  name<span class="token operator">:</span> <span class="token string">&quot;Current&quot;</span><span class="token punctuation">,</span>
  components<span class="token operator">:</span> <span class="token punctuation">{</span> PanelTemp <span class="token punctuation">}</span><span class="token comment">//&#x7EC4;&#x4EF6;&#x6CE8;&#x518C;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token keyword">class</span> <span class="token class-name">Current</span> <span class="token keyword">extends</span> <span class="token class-name">Vue</span> <span class="token punctuation">{</span>
  <span class="token keyword">private</span> winData<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token punctuation">{</span> direct<span class="token operator">:</span> <span class="token keyword">null</span><span class="token punctuation">,</span> roaming<span class="token operator">:</span> <span class="token keyword">null</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>
  <span class="token keyword">private</span> macData<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token punctuation">{</span> direct<span class="token operator">:</span> <span class="token keyword">null</span><span class="token punctuation">,</span> roaming<span class="token operator">:</span> <span class="token keyword">null</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>

  <span class="token comment">//&#x63A5;&#x53E3;&#x8C03;&#x7528;&#xFF0C;&#x83B7;&#x53D6; &#x9762;&#x677F;&#x521D;&#x59CB;&#x5316; &#x6570;&#x636E;</span>
  <span class="token keyword">async</span> <span class="token function">initList</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> <span class="token punctuation">{</span> data <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">drive_pages</span><span class="token punctuation">(</span><span class="token punctuation">{</span> isNewest<span class="token operator">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>data<span class="token punctuation">.</span>errNo <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">const</span> <span class="token punctuation">{</span> win<span class="token punctuation">,</span> mac <span class="token punctuation">}</span> <span class="token operator">=</span> OsType<span class="token punctuation">;</span>
      <span class="token keyword">const</span> <span class="token punctuation">{</span> direct<span class="token punctuation">,</span> roaming <span class="token punctuation">}</span> <span class="token operator">=</span> DriverType<span class="token punctuation">;</span>
      data<span class="token punctuation">.</span>item<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">item<span class="token operator">:</span> <span class="token builtin">any</span></span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
        <span class="token keyword">switch</span> <span class="token punctuation">(</span>item<span class="token punctuation">.</span>osType<span class="token punctuation">)</span> <span class="token punctuation">{</span>
          <span class="token keyword">case</span> win<span class="token operator">:</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>item<span class="token punctuation">.</span>driverType <span class="token operator">==</span> direct<span class="token punctuation">)</span> <span class="token punctuation">{</span>
              <span class="token keyword">this</span><span class="token punctuation">.</span>winData<span class="token punctuation">.</span>direct <span class="token operator">=</span> item<span class="token punctuation">;</span>
            <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>item<span class="token punctuation">.</span>driverType <span class="token operator">==</span> roaming<span class="token punctuation">)</span> <span class="token punctuation">{</span>
              <span class="token keyword">this</span><span class="token punctuation">.</span>winData<span class="token punctuation">.</span>roaming <span class="token operator">=</span> item<span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
          <span class="token keyword">case</span> mac<span class="token operator">:</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>item<span class="token punctuation">.</span>driverType <span class="token operator">==</span> direct<span class="token punctuation">)</span> <span class="token punctuation">{</span>
              <span class="token keyword">this</span><span class="token punctuation">.</span>macData<span class="token punctuation">.</span>direct <span class="token operator">=</span> item<span class="token punctuation">;</span>
            <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>item<span class="token punctuation">.</span>driverType <span class="token operator">==</span> roaming<span class="token punctuation">)</span> <span class="token punctuation">{</span>
              <span class="token keyword">this</span><span class="token punctuation">.</span>macData<span class="token punctuation">.</span>roaming <span class="token operator">=</span> item<span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
          <span class="token keyword">default</span><span class="token operator">:</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
  <span class="token function">created</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">//vue &#x94A9;&#x5B50;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">initList</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>script<span class="token operator">&gt;</span>
</code></pre>
<h5 id="componentsdrivetabletablets">components/DriveTable/table.ts</h5>
<blockquote>
<p>&#x6B64;&#x5904;&#x662F;ant-design-vue &#x4F7F;&#x7528;&#x8868;&#x683C;&#xFF08;a-table&#xFF09;&#x5728;&#x5B57;&#x6BB5;&#x58F0;&#x660E;&#x65F6;&#xFF0C;&#x548C;element&#x4F7F;&#x7528;&#x7684;&#x4E0D;&#x540C;&#x4E4B;&#x5904;&#x3002;</p>
</blockquote>
<pre class="language-"><code class="lang-typescript"><span class="token keyword">export</span> <span class="token keyword">const</span> columns<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">[</span>
  <span class="token punctuation">{</span>
    title<span class="token operator">:</span> <span class="token string">&quot;&#x65F6;&#x95F4;&quot;</span><span class="token punctuation">,</span>
    dataIndex<span class="token operator">:</span> <span class="token string">&quot;createTime&quot;</span><span class="token punctuation">,</span>
    sorter<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
    scopedSlots<span class="token operator">:</span> <span class="token punctuation">{</span> customRender<span class="token operator">:</span> <span class="token string">&quot;createTime&quot;</span> <span class="token punctuation">}</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">{</span>
    title<span class="token operator">:</span> <span class="token string">&quot;&#x7CFB;&#x7EDF;&#x7C7B;&#x578B;&quot;</span><span class="token punctuation">,</span>
    dataIndex<span class="token operator">:</span> <span class="token string">&quot;osType&quot;</span><span class="token punctuation">,</span>
    scopedSlots<span class="token operator">:</span> <span class="token punctuation">{</span> customRender<span class="token operator">:</span> <span class="token string">&quot;osType&quot;</span> <span class="token punctuation">}</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">{</span>
    title<span class="token operator">:</span> <span class="token string">&quot;&#x9A71;&#x52A8;&#x7C7B;&#x578B;&quot;</span><span class="token punctuation">,</span>
    dataIndex<span class="token operator">:</span> <span class="token string">&quot;driverType&quot;</span><span class="token punctuation">,</span>
    scopedSlots<span class="token operator">:</span> <span class="token punctuation">{</span> customRender<span class="token operator">:</span> <span class="token string">&quot;driverType&quot;</span> <span class="token punctuation">}</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">{</span>
    title<span class="token operator">:</span> <span class="token string">&quot;&#x7CFB;&#x7EDF;&#x4F4D;&#x6570;&quot;</span><span class="token punctuation">,</span>
    dataIndex<span class="token operator">:</span> <span class="token string">&quot;cpuBits&quot;</span><span class="token punctuation">,</span>
    scopedSlots<span class="token operator">:</span> <span class="token punctuation">{</span> customRender<span class="token operator">:</span> <span class="token string">&quot;cpuBits&quot;</span> <span class="token punctuation">}</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">{</span>
    title<span class="token operator">:</span> <span class="token string">&quot;&#x9A71;&#x52A8;&#x540D;&#x79F0;&quot;</span><span class="token punctuation">,</span>
    dataIndex<span class="token operator">:</span> <span class="token string">&quot;fileName&quot;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">{</span>
    title<span class="token operator">:</span> <span class="token string">&quot;&#x7248;&#x672C;&#x4FE1;&#x606F;&quot;</span><span class="token punctuation">,</span>
    dataIndex<span class="token operator">:</span> <span class="token string">&quot;version&quot;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">{</span>
    title<span class="token operator">:</span> <span class="token string">&quot;&#x53D8;&#x66F4;&#x5C65;&#x5386;&quot;</span><span class="token punctuation">,</span>
    dataIndex<span class="token operator">:</span> <span class="token string">&quot;description&quot;</span><span class="token punctuation">,</span>
    width<span class="token operator">:</span> <span class="token string">&quot;30%&quot;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">{</span>
    title<span class="token operator">:</span> <span class="token string">&quot;&#x64CD;&#x4F5C;&quot;</span><span class="token punctuation">,</span>
    align<span class="token operator">:</span> <span class="token string">&quot;center&quot;</span><span class="token punctuation">,</span>
    width<span class="token operator">:</span> <span class="token string">&quot;15%&quot;</span><span class="token punctuation">,</span>
    scopedSlots<span class="token operator">:</span> <span class="token punctuation">{</span> customRender<span class="token operator">:</span> <span class="token string">&quot;handler&quot;</span> <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">]</span><span class="token punctuation">;</span>
</code></pre>
<h5 id="componentsdrivetable">components/DriveTable</h5>
<blockquote>
<p>&#x9A71;&#x52A8;&#x4E00;&#x89C8;</p>
</blockquote>
<p><img src="../../images/drive_table.jpg" alt=""></p>
<pre class="language-"><code class="lang-typescript"><span class="token operator">&lt;</span>script lang<span class="token operator">=</span><span class="token string">&quot;ts&quot;</span><span class="token operator">&gt;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Component<span class="token punctuation">,</span> Vue <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;vue-property-decorator&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x88C5;&#x9970;&#x5668;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> drive_pages<span class="token punctuation">,</span> drive_count<span class="token punctuation">,</span> drive_delete <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/api/drive&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x63A5;&#x53E3;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> columns <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;./table&quot;</span><span class="token punctuation">;</span><span class="token comment">//a-table &#x8868;&#x683C;&#x58F0;&#x660E;&#x6587;&#x4EF6;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> OsType2Val<span class="token punctuation">,</span> DriverType2Val<span class="token punctuation">,</span> CpuBits2Val <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/common/Enum2Val&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> OsType<span class="token punctuation">,</span> CpuBits <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/utils/VEnum&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x679A;&#x4E3E;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> fmtDate <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/filters&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x8FC7;&#x6EE4;&#x5668;</span>
<span class="token keyword">import</span> ModalTemp <span class="token keyword">from</span> <span class="token string">&quot;./Modal.vue&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x81EA;&#x5B9A;&#x4E49;&#x6A21;&#x6001;&#x6846;&#x7EC4;&#x4EF6;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> PaginationMixin <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/mixins&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x5206;&#x9875; mixin</span>

@<span class="token function">Component</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token comment">//&#x7EC4;&#x4EF6;&#x58F0;&#x660E;</span>
  name<span class="token operator">:</span> <span class="token string">&quot;DriveTable&quot;</span><span class="token punctuation">,</span>
  components<span class="token operator">:</span> <span class="token punctuation">{</span> ModalTemp <span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token comment">//&#x7EC4;&#x4EF6;&#x6CE8;&#x518C;</span>
  filters<span class="token operator">:</span> <span class="token punctuation">{</span> fmtDate <span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token comment">//&#x8FC7;&#x6EE4;&#x5668;&#x6CE8;&#x518C;</span>
  <span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">//&#x5C5E;&#x6027;&#x58F0;&#x660E;</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
      OsType2Val<span class="token punctuation">,</span>
      DriverType2Val<span class="token punctuation">,</span>
      CpuBits2Val<span class="token punctuation">,</span>
      OsType
    <span class="token punctuation">}</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token keyword">class</span> <span class="token class-name">DriveTable</span> <span class="token keyword">extends</span> <span class="token class-name">PaginationMixin</span> <span class="token punctuation">{</span>
  <span class="token keyword">private</span> loading<span class="token operator">:</span> <span class="token builtin">boolean</span> <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>

  <span class="token keyword">private</span> data<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
  <span class="token keyword">private</span> columns<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token operator">=</span> columns<span class="token punctuation">;</span>

  <span class="token keyword">private</span> visited<span class="token operator">:</span> <span class="token builtin">number</span> <span class="token operator">=</span> OsType<span class="token punctuation">.</span>win<span class="token punctuation">;</span>

  <span class="token comment">//modal</span>
  <span class="token keyword">private</span> title<span class="token operator">:</span> <span class="token builtin">string</span> <span class="token operator">=</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">;</span>

  <span class="token comment">//&#x4E0B;&#x8F7D;&#x51FD;&#x6570;</span>
  <span class="token function">handlerDownload</span><span class="token punctuation">(</span><span class="token parameter">path<span class="token operator">:</span> <span class="token builtin">string</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    window<span class="token punctuation">.</span>location<span class="token punctuation">.</span>href <span class="token operator">=</span> path<span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//&#x8868;&#x683C; &#x70B9;&#x51FB;&#x65E5;&#x671F;&#x6392;&#x5E8F; &#x65F6; &#x89E6;&#x53D1;</span>
  <span class="token function">handleTableChange</span><span class="token punctuation">(</span><span class="token parameter">pagination<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">,</span> filters<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">,</span> sorter<span class="token operator">:</span> <span class="token builtin">any</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> pager <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token operator">...</span><span class="token keyword">this</span><span class="token punctuation">.</span>pagination <span class="token punctuation">}</span><span class="token punctuation">;</span>
    pager<span class="token punctuation">.</span>current <span class="token operator">=</span> pagination<span class="token punctuation">.</span>current<span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>pagination <span class="token operator">=</span> pager<span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">initList</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//&#x6253;&#x5F00; modal</span>
  <span class="token function">openModal</span><span class="token punctuation">(</span><span class="token parameter">title<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> row<span class="token operator">:</span> <span class="token builtin">any</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>title <span class="token operator">=</span> title<span class="token punctuation">;</span>
    <span class="token keyword">const</span> temp<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>$refs<span class="token punctuation">.</span>modal<span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">$nextTick</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span>title <span class="token operator">===</span> <span class="token string">&quot;edit&quot;</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        temp<span class="token punctuation">.</span><span class="token function">initFormData</span><span class="token punctuation">(</span>title<span class="token punctuation">,</span> row<span class="token punctuation">)</span><span class="token punctuation">;</span>
        temp<span class="token punctuation">.</span><span class="token function">showModal</span><span class="token punctuation">(</span>title<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
        temp<span class="token punctuation">.</span><span class="token function">initFormData</span><span class="token punctuation">(</span>title<span class="token punctuation">,</span> <span class="token punctuation">{</span> cpuBits<span class="token operator">:</span> CpuBits<span class="token punctuation">.</span>general <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        temp<span class="token punctuation">.</span><span class="token function">showModal</span><span class="token punctuation">(</span>title<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//&#x5220;&#x9664; &#x51FD;&#x6570;</span>
  <span class="token keyword">async</span> <span class="token function">handlerDelete</span><span class="token punctuation">(</span><span class="token parameter">id<span class="token operator">:</span> <span class="token builtin">string</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">try</span> <span class="token punctuation">{</span>
      <span class="token keyword">const</span> <span class="token punctuation">{</span> data <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">drive_delete</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>$message<span class="token punctuation">.</span><span class="token function">success</span><span class="token punctuation">(</span><span class="token string">&quot;&#x5220;&#x9664;&#x6210;&#x529F;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">initList</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF; &#x6807;&#x7B7E;&#x9875; &#x7B5B;&#x9009;&#x6846;&#x89E6;&#x53D1;&#x51FD;&#x6570;</span>
  <span class="token function">handlerBitsClick</span><span class="token punctuation">(</span><span class="token parameter">e<span class="token operator">:</span> <span class="token builtin">number</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>visited <span class="token operator">=</span> e<span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">initList</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//&#x63A5;&#x53E3;&#x8C03;&#x7528; &#x83B7;&#x53D6;&#x8868;&#x683C;&#x6570;&#x636E;</span>
  <span class="token keyword">async</span> <span class="token function">initList</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> paper<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>pagination<span class="token punctuation">;</span>
    <span class="token keyword">const</span> current<span class="token operator">:</span> <span class="token builtin">number</span> <span class="token operator">=</span> paper<span class="token punctuation">.</span>current<span class="token punctuation">;</span>
    <span class="token keyword">const</span> query <span class="token operator">=</span> <span class="token punctuation">{</span>
      isNewest<span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span>
      page<span class="token operator">:</span> current<span class="token punctuation">,</span>
      count<span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span>pageSize<span class="token punctuation">,</span>
      osType<span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span>visited
    <span class="token punctuation">}</span><span class="token punctuation">;</span>
    <span class="token keyword">try</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>loading <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
      <span class="token keyword">const</span> <span class="token punctuation">[</span><span class="token punctuation">{</span> data<span class="token operator">:</span> page <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> data<span class="token operator">:</span> count <span class="token punctuation">}</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token builtin">Promise</span><span class="token punctuation">.</span><span class="token function">all</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
        <span class="token function">drive_pages</span><span class="token punctuation">(</span>query<span class="token punctuation">)</span><span class="token punctuation">,</span>
        <span class="token function">drive_count</span><span class="token punctuation">(</span>query<span class="token punctuation">)</span>
      <span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>loading <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>pagination<span class="token punctuation">.</span>total <span class="token operator">=</span> count<span class="token punctuation">.</span>item<span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>data <span class="token operator">=</span> page<span class="token punctuation">.</span>item<span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>loading <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>script<span class="token operator">&gt;</span>
</code></pre>
<blockquote>
<p>&#x65B0;&#x5EFA;/&#x7F16;&#x8F91;&#x6A21;&#x6001;</p>
</blockquote>
<p><img src="../../images/drive_modal.jpg" alt=""></p>
<pre class="language-"><code class="lang-typescript"><span class="token operator">&lt;</span>script lang<span class="token operator">=</span><span class="token string">&quot;ts&quot;</span><span class="token operator">&gt;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Component<span class="token punctuation">,</span> Prop<span class="token punctuation">,</span> Emit<span class="token punctuation">,</span> Vue <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;vue-property-decorator&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x88C5;&#x9970;&#x5668;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> selectColumns <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/common/AntSelectConfig&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x4E0B;&#x62C9;&#x6846;&#x9759;&#x6001;&#x53D8;&#x91CF;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Upload <span class="token keyword">as</span> UploadTemp <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/components&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x81EA;&#x5B9A;&#x4E49;&#x4E0A;&#x4F20;&#x7EC4;&#x4EF6;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> drive_upload<span class="token punctuation">,</span> drive_edit <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/api/drive&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x63A5;&#x53E3;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> CpuBits <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/utils/VEnum&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x679A;&#x4E3E;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> IDriver <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/model/Driver&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x53D8;&#x91CF;&#x58F0;&#x660E;&#x6587;&#x4EF6;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> CloneDeep <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/utils&quot;</span><span class="token punctuation">;</span><span class="token comment">//&#x5DE5;&#x5177;</span>
<span class="token keyword">import</span> formItemLayout <span class="token keyword">from</span> <span class="token string">&quot;@/common/FormItemLayout&quot;</span><span class="token punctuation">;</span><span class="token comment">//formItem&#x6837;&#x5F0F;</span>

@<span class="token function">Component</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
  components<span class="token operator">:</span> <span class="token punctuation">{</span> UploadTemp <span class="token punctuation">}</span><span class="token comment">//&#x7EC4;&#x4EF6;&#x6CE8;&#x518C;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token keyword">class</span> <span class="token class-name">DriveModdal</span> <span class="token keyword">extends</span> <span class="token class-name">Vue</span> <span class="token punctuation">{</span>
  <span class="token keyword">private</span> selectColumns<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> selectColumns<span class="token punctuation">;</span>
  <span class="token keyword">private</span> isUpload<span class="token operator">:</span> <span class="token builtin">boolean</span> <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
  <span class="token keyword">private</span> visible<span class="token operator">:</span> <span class="token builtin">boolean</span> <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
  <span class="token keyword">private</span> confirmLoading<span class="token operator">:</span> <span class="token builtin">boolean</span> <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
  <span class="token keyword">private</span> form<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
  <span class="token keyword">private</span> formItemLayout<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> formItemLayout<span class="token punctuation">;</span>
  <span class="token keyword">private</span> uploadData<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>

  @<span class="token function">Prop</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token keyword">type</span><span class="token operator">:</span> String <span class="token punctuation">}</span><span class="token punctuation">)</span> title<span class="token operator">!</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span><span class="token comment">// vue prop</span>

  <span class="token function">created</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">//&#x94A9;&#x5B50;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>form <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>$form<span class="token punctuation">.</span><span class="token function">createForm</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//&#x9644;&#x4EF6;&#x4E0A;&#x4F20;&#x3001;&#x79FB;&#x9664;&#x65F6;&#x89E6;&#x53D1;</span>
  <span class="token function">handlerUpload</span><span class="token punctuation">(</span><span class="token parameter">check<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> file<span class="token operator">:</span> <span class="token builtin">any</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>check <span class="token operator">==</span> <span class="token string">&quot;remove&quot;</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>form<span class="token punctuation">.</span><span class="token function">setFieldsValue</span><span class="token punctuation">(</span><span class="token punctuation">{</span> filePath<span class="token operator">:</span> <span class="token keyword">null</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">delete</span> <span class="token keyword">this</span><span class="token punctuation">.</span>uploadData<span class="token punctuation">.</span>filePath<span class="token punctuation">;</span>
      <span class="token keyword">delete</span> <span class="token keyword">this</span><span class="token punctuation">.</span>uploadData<span class="token punctuation">.</span>fileName<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>check <span class="token operator">==</span> <span class="token string">&quot;done&quot;</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">const</span> <span class="token punctuation">{</span> filePath<span class="token punctuation">,</span> fileSize <span class="token punctuation">}</span> <span class="token operator">=</span> file<span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>form<span class="token punctuation">.</span><span class="token function">setFieldsValue</span><span class="token punctuation">(</span><span class="token punctuation">{</span> filePath<span class="token punctuation">,</span> fileSize <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//modal &#x5C55;&#x793A;</span>
  <span class="token function">showModal</span><span class="token punctuation">(</span><span class="token parameter">check<span class="token operator">:</span> <span class="token builtin">string</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>visible <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">$nextTick</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      <span class="token keyword">const</span> vm<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>$refs<span class="token punctuation">.</span>uploadTemp<span class="token punctuation">;</span>
      vm<span class="token punctuation">.</span><span class="token function">initTemp</span><span class="token punctuation">(</span>check<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//&#x8868;&#x5355;&#x63D0;&#x4EA4;</span>
  <span class="token keyword">async</span> <span class="token function">handleOk</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">Promise</span><span class="token operator">&lt;</span><span class="token builtin">any</span><span class="token operator">&gt;</span> <span class="token punctuation">{</span>
    <span class="token comment">//&#x8868;&#x5355;&#x6821;&#x9A8C;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>form<span class="token punctuation">.</span><span class="token function">validateFields</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">err<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">,</span> values<span class="token operator">:</span> <span class="token builtin">any</span></span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>err<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">submit</span><span class="token punctuation">(</span>values<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span>
      <span class="token keyword">return</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  @<span class="token function">Emit</span><span class="token punctuation">(</span><span class="token string">&quot;submit&quot;</span><span class="token punctuation">)</span><span class="token comment">// this.$emit(&quot;submit&quot;, [boolean]);</span>
  <span class="token keyword">async</span> <span class="token function">submit</span><span class="token punctuation">(</span><span class="token parameter">form<span class="token operator">:</span> <span class="token builtin">any</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>form<span class="token punctuation">)</span> <span class="token keyword">return</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
    <span class="token keyword">const</span> <span class="token punctuation">{</span> fileName <span class="token punctuation">}</span> <span class="token operator">=</span> form<span class="token punctuation">;</span>
    <span class="token keyword">const</span> _fileName <span class="token operator">=</span> fileName<span class="token punctuation">.</span><span class="token function">replace</span><span class="token punctuation">(</span><span class="token regex">/^\s+|\s+$/g</span><span class="token punctuation">,</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>_fileName<span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>$message<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span><span class="token string">&quot;&#x9A71;&#x52A8;&#x540D;&#x79F0;&#x4E0D;&#x80FD;&#x4E3A;&#x7A7A;&#xFF01;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">return</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">try</span> <span class="token punctuation">{</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span>title <span class="token operator">===</span> <span class="token string">&quot;edit&quot;</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">const</span> _editForm<span class="token operator">:</span> IDriver <span class="token operator">=</span> <span class="token function">CloneDeep</span><span class="token punctuation">(</span>form<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">delete</span> _editForm<span class="token punctuation">.</span>_id<span class="token punctuation">;</span>
        <span class="token keyword">const</span> <span class="token punctuation">{</span> data <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">drive_edit</span><span class="token punctuation">(</span>form<span class="token punctuation">.</span>_id<span class="token punctuation">,</span> _editForm<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">handleCancel</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>$message<span class="token punctuation">.</span><span class="token function">success</span><span class="token punctuation">(</span><span class="token string">&quot;&#x7F16;&#x8F91;&#x6210;&#x529F;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
        <span class="token keyword">const</span> <span class="token punctuation">{</span> data <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">drive_upload</span><span class="token punctuation">(</span>form<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>data<span class="token punctuation">.</span>errNo <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
          <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">handleCancel</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
          <span class="token keyword">this</span><span class="token punctuation">.</span>$message<span class="token punctuation">.</span><span class="token function">success</span><span class="token punctuation">(</span><span class="token string">&quot;&#x64CD;&#x4F5C;&#x6210;&#x529F;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
          <span class="token keyword">return</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//modal &#x5173;&#x95ED;&#x65F6; &#x89E6;&#x53D1;</span>
  <span class="token function">handleCancel</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> vm<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>$refs<span class="token punctuation">.</span>uploadTemp<span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>visible <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">//&#x521D;&#x59CB;&#x5316;form&#x8868;&#x5355; &#x6570;&#x636E;</span>
  <span class="token function">initFormData</span><span class="token punctuation">(</span><span class="token parameter">check<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> values<span class="token operator">:</span> IDriver</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>check <span class="token operator">==</span> <span class="token string">&quot;edit&quot;</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">$nextTick</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
        <span class="token keyword">const</span> <span class="token punctuation">{</span> httpPath <span class="token punctuation">}</span> <span class="token operator">=</span> values<span class="token punctuation">;</span>
        <span class="token keyword">const</span> datas <span class="token operator">=</span> httpPath<span class="token punctuation">.</span><span class="token function">split</span><span class="token punctuation">(</span><span class="token string">&quot;/&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">const</span> driverName <span class="token operator">=</span> datas<span class="token punctuation">[</span>datas<span class="token punctuation">.</span>length <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>uploadData <span class="token operator">=</span> <span class="token punctuation">{</span> driverName <span class="token punctuation">}</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>uploadData <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">const</span> <span class="token punctuation">{</span>
      _id<span class="token punctuation">,</span>
      fileName<span class="token punctuation">,</span>
      fileSize<span class="token punctuation">,</span>
      driverType<span class="token punctuation">,</span>
      osType<span class="token punctuation">,</span>
      cpuBits<span class="token punctuation">,</span>
      version<span class="token punctuation">,</span>
      description<span class="token punctuation">,</span>
      filePath
    <span class="token punctuation">}</span> <span class="token operator">=</span> values<span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>form<span class="token punctuation">.</span><span class="token function">setFieldsValue</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
      _id<span class="token punctuation">,</span>
      fileName<span class="token punctuation">,</span>
      fileSize<span class="token punctuation">,</span>
      driverType<span class="token punctuation">,</span>
      osType<span class="token punctuation">,</span>
      cpuBits<span class="token punctuation">,</span>
      version<span class="token punctuation">,</span>
      description<span class="token punctuation">,</span>
      filePath
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>script<span class="token operator">&gt;</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="login.html" class="navigation navigation-prev " aria-label="Previous page: login">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="logs.html" class="navigation navigation-next " aria-label="Next page: logs">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"drive","level":"2.13.3","depth":2,"next":{"title":"logs","level":"2.13.4","depth":2,"path":"src/views/logs.md","ref":"src/views/logs.md","articles":[]},"previous":{"title":"login","level":"2.13.2","depth":2,"path":"src/views/login.md","ref":"src/views/login.md","articles":[]},"dir":"ltr"},"config":{"plugins":["chapter-fold","-lunr","-search","search-pro","-highlight","prism"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"prism":{"css":["prismjs/themes/prism-tomorrow.css"]},"chapter-fold":{},"search-pro":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Gj","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"驱动管理","language":"zh-hans","gitbook":"3.2.3","description":"驱动管理Web端"},"file":{"path":"src/views/drive.md","mtime":"2020-02-28T07:59:51.052Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-03T02:33:20.679Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

